#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <map>
#include <climits>
/*
https://www.nowcoder.com/test/question/f5a3b5ab02ed4202a8b54dfb76ad035e?pid=30440590&tid=45777216s
*/

using namespace std;
int gcd(int a,int b){
    return b?gcd(b,a%b):a;
}
int lcm(int a,int b){
    return a*b/gcd(a,b);
}

int main(){
    int A,B,a,b;
    cin >> A >> B >> a >> b;
    int t=gcd(a,b);
    a/=t;
    b/=t;
    int m=min(A/a,B/b);
    cout << a*m << " "<< b*m <<endl;
    return 0;
}